function gameOnChangeDesk(){
	gameOnStand();
	gameOnSit(getRoomId());
}


// 坐下
function gameOnSit(roomId){
	setRoomId(roomId);
	var jsObj = new Dto();
	jsObj.type = MessageType.SIT;
	jsObj.roomId = roomId;
	sendMessage(jsObj);
}

//离开牌桌
function gameOnStand(){
	var jsObj = new Dto();
	jsObj.type = MessageType.STAND;
	sendMessage(jsObj);
}

// 准备好了
function gameOnReady(){
	//隐藏三个玩家的加倍数
	player.hideInfo().multiple("left");
	player.hideInfo().multiple("right");
	player.hideInfo().multiple("my");
	
	//清除底牌
	toolBar.clearBottomPokey();
	
	//将三个玩家的头像恢复为农民
	player.setInfo().head("left", false);
	player.setInfo().head("my", false);
	player.setInfo().head("right", false);
	
	//牌数清零
	player.setInfo().pokeyNum("left",0);
	player.setInfo().pokeyNum("right",0);

	var jsObj = new Dto();
	jsObj.type = MessageType.READY;
	sendMessage(jsObj);
}

//开局
function openGame(){
	var jsObj = new Dto();
	jsObj.type = MessageType.OPEN_GAME;
	sendMessage(jsObj);
}

// 抢地主
function gameOnGrabLandLord(grabLandlordBetCount){
	var jsObj = new Dto();
	jsObj.type = MessageType.GRAB_LANDLORD;
	jsObj.grabLandlordBetCount = grabLandlordBetCount;
	sendMessage(jsObj);
}

// 出牌
function gameOnOutCard(cardsArr){
	var jsObj = new Dto();
	jsObj.type = MessageType.OUT_CARD;
	jsObj.cards = cardsArr.join("-");
	console.log("出牌  gameOnOutCard : "+JSON.stringify(jsObj));
	sendMessage(jsObj);
}

// 不出牌
function gameOnNotOutCard(){
	var jsObj = new Dto();
	jsObj.type = MessageType.NOT_OUT_CARD;
	sendMessage(jsObj);
}

// 出牌倒计时30s超时
function gameOnTimeOutOnOutCard(){
	var jsObj = new Dto();
	jsObj.type = MessageType.TIME_OUT_ON_OUT_CARDS;
	console.log("出牌超时");
	sendMessage(jsObj);
}

//聊天消息
function gameOnSendChatMessage(content){
	var jsObj = new Dto();
	jsObj.type = MessageType.SEND_CHAT_MESSAGE;
	jsObj.content = content;
	sendMessage(jsObj);
}

// 进入托管状态
function gameOnRequestManaged(){
	my.button().clear();

	var jsObj = new Dto();
	jsObj.type = MessageType.REQUEST_MANAGED;
	sendMessage(jsObj);
	
}

// 取消托管状态
function gameOnRequestUnmanaged(){
	var jsObj = new Dto();
	jsObj.type = MessageType.REQUEST_UNMANAGED;
	sendMessage(jsObj);
}

// 出牌提示 , n代表是第几轮的提示
function gameOnRequestOutCardSussestion(option,timeStamp){
	var jsObj = new Dto();
	jsObj.type = MessageType.REQUEST_OUTCARD_SUGGESTION;
	jsObj.option = option;
	jsObj.timeStamp = timeStamp;
	sendMessage(jsObj);
}

// 农民加倍（踢）
function gameFarmerDouble(doubleFlag){
	var jsObj = new Dto();
	jsObj.type = MessageType.FARMER_DOUBLE;
	jsObj.doubleFlag =doubleFlag;
	sendMessage(jsObj);
}

// 地主加倍（反踢）
function gameLandlordDouble(doubleFlag, playerId){
	var jsObj = new Dto();
	jsObj.type = MessageType.LANDLORD_DOUBLE;
	jsObj.doubleFlag = doubleFlag;
	jsObj.playerId = playerId;
	sendMessage(jsObj);
}

//强行退出
function forceOut(playerId){
	var jsObj = new Dto();
	jsObj.type = MessageType.FORCE_OUT;
	jsObj.playerId = playerId;
	sendMessage(jsObj);
}

function requestReturnHall(playerId) {
	
	var jsObj = new Dto();
	jsObj.type = 20000014;
	jsObj.playerId = playerId;
	sendMessage(jsObj);
}

/* 使用道具*/
function requestUseItem(itemToken) {
	var jsObj = new Dto();
	jsObj.type = 20000017;
	jsObj.itemToken = itemToken;
	sendMessage(jsObj);
}
// 消息构造
function Dto(){}

